# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pygobject
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-gobject")
pkgver=3.36.1
pkgrel=1
pkgdesc="Python Bindings for GLib/GObject/GIO/GTK+ (mingw-w64)"
arch=(any)
url="https://pygobject.readthedocs.io"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-python-cairo"
         "${MINGW_PACKAGE_PREFIX}-libffi"
         "${MINGW_PACKAGE_PREFIX}-gobject-introspection-runtime")
makedepends=("${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection")
provides=("${MINGW_PACKAGE_PREFIX}-pygobject-devel"
          "${MINGW_PACKAGE_PREFIX}-python3-gobject=${pkgver}")
conflicts=("${MINGW_PACKAGE_PREFIX}-pygobject-devel"
           "${MINGW_PACKAGE_PREFIX}-python3-gobject")
replaces=("${MINGW_PACKAGE_PREFIX}-pygobject-devel"
          "${MINGW_PACKAGE_PREFIX}-python3-gobject")
source=(https://download.gnome.org/sources/pygobject/${pkgver%.*}/${_realname}-${pkgver}.tar.xz)
sha256sums=('d1bf42802d1cec113b5adaa0e7bf7f3745b44521dc2163588d276d5cd61d718f')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

  ${MINGW_PREFIX}/bin/python3 setup.py build
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  # --no-compile because older packages didn't install .pyc and adding them
  # would lead to upgrade conflicts
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --no-compile
}
